<?php
class MwthAction extends CommonAction {
    public function index(){
		$db = M('News');
		//计算总页数
		$count=$db -> count();
		//实例化分页类
		import ( 'ORG.Util.Page' );
		$p=new Page($count,20);
		$list = $db->where($map)->order('id desc')->limit($p->firstRow.', 
'.$p->listRows)->select();
        $pages=$p->show();
		$this->assign('list',$list);
		$this->assign('pages',$pages);
		
		$this->display();
    }
	
	
	public function display($temp = ''){
		if(IS_AJAX){
			$list = $_GET['list'];
			$empty = 1;
			$statu=$list?1:0;
			if($this->get('list')){
				$empty = 0;
			}
			$this->initView();
			die(json_encode(array('empty' => $empty,'tbody'=>$this->fetch($temp),'dump'=>$_REQUEST,'statu'=>$statu, 'pages' => $this->view->get('pages'))));	 
		}else{
			parent::display($temp);
		} 
	}

}